What is RegDACL good for?
RegDACL allows you to query and change the discretionary access
control list (DACL) of any Windows NT Registry key. You can of course use
the program RegEdt32 to set registry permissions, but if you need
to edit more than a few machines then you are faced with quite a boring
job, not to mention being more prone to make mistakes. RegDACL gives
you the ability to use a batch script to perform this job. The freeware
versions of RegDACL allow you to define access permissions for the
predefined groups Administrators, Everyone, Interactive, Network, System,
Creator Owner, User, Authenticated Users, Batch, Local, Service, Anonymous
Logon, Domain Administrators, Domain Users and DomainGuests
and in much more detail than RegEdt32 will allow. The
registered version of RegDACL will in addition allow you to change
permissions for all kinds of local and domain accounts and groups.
There are quite some differences how the programs RegEdt32 for NT
4 and RegEdt32 for NT 5 (often referred to as Windows 2000)
manage security settings for Registry keys. For this reason there used
to coexist two versions of RegDACL, one for NT 4 and another for
NT 5. But most administrators have to manage networks with mixed versions
of NT. For this reason we added some more intelligence to the program.
Now it first checks which version of NT runs on the target machine. With
this knowledge it decides what options are allowed and what method might
be the most successful when trying to read and change security settings.
What licence terms apply to the use of RegDACL?
This software was developed with the greatest
attention to detail. However, the author can not guarantee that it runs
under every version of Windows NT or on each computer flawlessly. Use of
this program is at your own discretion. The copyright holder provides the
program "as is" without warranty of any kind. RegDACL is a very powerful
tool, and with one wrong command you can cause much havoc to your machines!
So make sure you know what you do when using this tool! Reading and understanding
this document should help you to avoid mistakes!
RegDACL version 5.x is Freeware. You are allowed to distribute this version of the software as long as you include all files as you received them with the zip file, did not change any of them, and do not charge for the distribution. You are not allowed to distribute the file on your web page or ftp server - but you may and should use a link to www.heysoft.de. This will insure you always receive the latest version of the software.
RegDACL version 6.x is available to registered users only as part of RegTools for Windows NT. Other tools in this product are RegOwner and RegAudit for managing ownership and audit settings of Registry keys. Both of these tools are not available as Freeware.
An order form for RegTools is included within the zip file of the freeware versions. Under no circumstances you are allowed to re-distribute registered versions of the software.
What is a DACL?
The Discretionary Access Control List (DACL) is controlled by the owner
of an object and specifies the access particular users or groups can have
to that object.With RegDACL you can manage DACLs of Registry keys.
An access-control entry (ACE) is an element in an access-control list
(ACL). An ACL can have zero or more ACEs. Each ACE controls or monitors
access to an object by a specified trustee and contains several fields,
all of which you will see in detail by using the command /L.
Note: If you need to manage DACLs of files or directories on an NTFS
volume, you can use CACLS, which comes with NT, or the NT resource
kit utility XCACLS which provides some extended functionality.
What are the requirements to use the program successfully?
This is the (quite long ;) help screen you will see when you type RegDACL
/?:
RegDACL 6.0 - DACL Manager for Registry keys
for Windows NT 4 and above
Copyright (c) 1999-2001 Frank Heyne Software (http://www.heysoft.de) Usage: RegDACL Key Commands Key: [\\computer\]root[\subkey]
Query Commands:
Change Commands:
Other Commands:
Options for xx:
possible options for Perms:
possible options for I (Inheritance
flags):
|
Note: Parameters are not case sensitive.
- The full path to the Registry key whose DACL you wish to modify.
- Provide at least one command for the query to ask or the changes to make to the specified registry key. If no command is specified the program will do (surprise!) nothing.
[\\Computer\]Root[\Subkey]If no computer name is specified then the local machine will be used. If you don't specify a subkey, the root key is used. One of the following abbreviations is used for the five possible root keys:Example:[\\PegasusNT1\]HKLM\System\CurrentControlSet\Enum
HKLM - HKEY_LOCAL_MACHINEIf the registry path contains spaces, then the entire path must be enclosed within "double quotes". (You may use double quotes anyway as a practice as doing so will have no adverse effects.)
HKU - HKEY_USERS
HKCU - HKEY_CURRENT_USER
HKCC - HKEY_CURRENT_CONFIG
HKCR - HKEY_CLASSES_ROOT
Switchs
The switch -ANSI
With the -ansi switch you tell the program to use the ANSI character
set instead of the default OEM character set. As you probably know, OEM
is the default character set of the command line window. ANSI is the usual
character set for most GUI programs. The use of this option is recommended
if you pipe the output of the utility into a file, which will be processed
with a GUI program later.
The switch -SUBTREE (only
available in the registered version of RegDACL)
With the -subtree switch you tell RegDACL to employ all
command(s) to the specified key and its subtree, instead of just working
with the key itself. There are some exceptions: When using the commands
/F, /PI or /PROPAGATE, no switch -SUBTREE is allowed
because these commands scan the subtree by default.. In addition, it would
be a problem to interpret the return values of the commands /Q or
/A in conjunction with -SUBTREE. For this reason these combinations
are not allowed either.
Commands
You can group as many commands as you like at
the same time, with the exception of /F, /PI and /PROPAGATE,
which are not allowed together with other commands. Commands are
processed in the following order:
C:\Reg> RegDACL
hklm\software\test /L
Access Control List for Registry key "hklm\software\test":
|
Column 1 - Inheritance flags
Windows NT allows some very specific inheritance settings, but strangely
enough they cannot be applied using the built in registry editors that
come with NT 4. RegDACL, however, allows you to take full advantage
of these detailed settings as explained below.
(CI) (Container Inherit) - By default, when a new registry subkey
is created with Regedit or Regedt32, it inherits the permissions
of its parent, (which is what the key located one level above in the tree
structure is referred to as) .
(IO) (Inherit Only) This ACE is applied only on entries created
under a parent subkey (children and grandchildren), but not for the parent
key (= this key) itself. This is the only useful setting for the pseudo
account Creator-Owner, as shown in tutorial
2.
(NI) (No Inherit) - You may create an ACE which won't be inherited
at all - it will apply only to the specified key.
(NP) (No Progpagate) -Valid only together with either (CI) or
(IO). The option NP has the effect that the ACE placed on a key is inherited
only by its child keys, but will not propagate further to grandchild keys.
Thus:
(CI-NP) would mean that the ACE is valid for the key itself
and any subkeys (children) created under it, but not for any possible grandchildren
created under these subkeys .
(IO-NP) means that the ACE will apply
only to the subkeys of the specified key, not to the key itself
or any grandchild keys.
(ID) (InheriteD) - New in Windows 2000. Earlier versions of
Windows NT did inherit permissions only when a child object was created.
When you later changed the permissions of the parent (without specifying
that the permissions of the entire subtree beneath it should be changed
as well, thus overwriting all changes made to the DACLs of any subkeys),
no permissions of child keys were changed. Because Windows 2000 marks inherited
ACEs with a combination of (ID) and one of (CI), (IO)
or (NI), it knows everytime whether an ACE was inherited or explicitly
applied to this object. This way Windows 2000 can propagate changes of
permissions of parent keys to all subkeys which inherited them, while leaving
additional ACEs applied to its subkeys alone.
(ID-CI) (InheriteD - Container Inherit) - The inherited ACE
is valid for this key and its subkeys. When the origin of this ACE will
be changed, the inherited ACE changes as well. It originates from a (CI)
entry.
(ID-IO) (InheriteD - Inherit Only) This inherited ACE is valid
for entries under the current key (children and grandchildren), but not
for the key itself. It originates from an (IO) entry.
(ID-NI) (InheriteD - No Inherit) - This inherited ACE is valid
for the current key, but not for its subkeys. It originates from an entry
containing the (NP) flag.
Part 2 of this document contains a tutorial
demonstrating the effects of different inheritance flags.
Important: If no inheritance flag is specified,
RegDACL uses a default value which depends on the selected action.
Actions reading something now look for any ACEs. Actions writing
something use (CI) as a default - just as it would be if you set your security
manually using Regedt32.
Column 2 - Type of the entry
There are only two possibilities, allow and deny. ALLOW means that
the entry contains permissions which are allowed for this account. DENY
means that the permissions in this entry are denied to this account. As
with inheritance information, RegEdt32 in versions prior to NT 5 did not
accept DENY ACEs and insisted on deleting the complete DACL, when you clicked
on Security | Permissions and the DACL contained at least one
DENY entry.
Column 3 - Permissions
NT allows 10 basic permissions for registry keys and 2 composite, which
may be combined at your convenience:
Q | Query value (like Read for a file) |
W | Write value (Regedt32 "Set Value") |
C | Create subkey (like creating a subdirectory in a file system) |
E | Enumerate subkeys (like listing files and subdirectories with the DIR command) |
N | Notify (needed for using the Win32-API function RegNotifyChangeKeyValue) |
O | write Owner (changing the owner associated with the specified key) |
L | create Link (normally only the operating system uses this permission) |
D | Delete (Removing the specified key, its subkeys, and all associated values) |
S | read Security information (Regedt32 "Read Control"- allows the permission holder to read the ACL for the key) |
A | write DAC (Allows the permission owner to change the DACL entries attached to the specified key) |
Column 4 - Account
This column reports which group or account the entry is in effect for.
This can be a predefined (account groups built into NT) group, or any custom
created local or domain group, or individual user account.
Example 1 is from a standalone machine which is not a member of an
NT domain. The last entry belongs to a deleted user account.
The command /E
With this command you can view the Effective permissions (those
which are actively in effect) for a key. The table shows that only accounts
which have at least one entry in the DACL are displayed. Lets have a look
at the differences in the results produced by the commands /L and /E here
in Example 2:
C:\Reg> RegDACL
hklm\software\test /L /E
Access Control List for Registry key
Effective permissions for Registry key "hklm\software\test":
|
The command /Q
With this command you can Query a key - whether an entry with
one or more permissions exists in its DACL or not. RegDACL will
return the result of the query in two different ways. At first it prints
the answer as a line of text, at second it answers with different return
values. If all queried permissions exist then RegDACL will return
0. If at least one of the queried permissions is missing, then the return
value will be 1. The following Examples 3 and 4 were used to query the
Registry key from Example 2:
C:\Reg> RegDACL
hklm\software\test /qgo:q(ci)
Testing ACEs of predefined group "Creator
Owner"
|
C:\Reg> RegDACL
hklm\software\test /qgo:q
Testing ACEs of predefined group "Creator
Owner"
|
@echo off
RegDACL hklm\software /qge:c^
&& echo Everyone can install software
on this machine :-(^
|| echo Not Everyone can install software
here :-)
When you (like in the following Example 5) call test.cmd, either
the command after && or the command after || will be executed.
You could of course change out the echo command with something
more useful, maybe a command which writes an entry into the eventlog or
sends an email to you when an important key with too much permissions is
found! Your imagination is the only limit!
C:\Reg> test
Testing ACEs of really "Everyone"
|
The command /A
Compared with command /Q the command /A works like command /E compared
with /L. Instead of testing the ACEs (like /Q does) the effective permissions
are tested with /A.
The output is the same as in the command /Q - a line of text and a
return value, but the return value will be 0 only if all permissions are
granted to the specified group (either directly or to another group it
is belonging to, like Everyone) and 1 in all other cases. Example
6 applies to the key from example 2 as well.
C:\Reg> RegDACL
hklm\software\test /ago:q
Testing effective permissions of predefined
group "Creator Owner"
|
The command /F
This command scans the ACEs of all keys in the specified subtree of
the Registry. It returns a list of all keys which contain ACEs with the
perms you specified. The command /F is available
only in the registered version of RegDACL.
C:\Reg> RegDACL
hklm /fge:d
Searching all Registry keys beneath hklm with
the permissions D for really "Everyone":
|
The command /PI
As discussed earlier in this document, beginning with Windows NT 5
objects inherit their permissions from parents in a new way: Changes made
to the DACL of a parent will always propagate to all objects in the subtree
beneath the parent. This is very useful in most cases, but there are situations
where it is not so good. But there is a solution for such cases: You can
uncheck "Allow inheritable permissions from parent to propagate to this
object" in the Security | Permissions dialog of RegEdt32.
Doing so protects the object from inheriting any ACE from its parents.
The command /PI (available only in the
registered version of RegDACL) lists all subkeys which
are protected. It does not work in Windows NT 4.0 and earlier.
C:\Reg> RegDACL
hklm\software\Microsoft /pi
Searching all protected Registry keys beneath
hklm\software\Microsoft\Windows...
|
This concludes the description of the commands that allow you to query the DACLs of Registry keys. Now you will become acquainted with the commands which allow you to modify the DACLs of Registry keys. The functions which change ACEs do not accept inheritance options with the (ID) flag set, because this would make no sense! If you want to change such an ACE, do it in the key where it is defined, not in the dependent subkey!
Let us start with the commands /P... which control inheritance. They all work only in Windows NT 5 and above. It is possible, but very dangerous to use these commands together with the switch -SUBTREE. Do not so with keys installed by Windows 2000 itself, you might brake some functionality! While RegEdt32 warns you when making changes equivalent to the /P cammands, RegDACL does not. This is because RegDACL is most often used in scripts which are designed to run without user intervention.
The command /P-
This command removes the inheritance protection of a key. Current ACEs
of the key (and its unprotected subkeys) will be replaced by the inheritable
ACEs of its parents.
Using this command correspondents to checking "Allow inheritable permissions
from parent to propagate to this object" in the Security | Permissions
dialog of RegEdt32
The command /PC
This command Protects a key and Copies formerly inherited
permissions to it. ACEs defined directly for this key will not change,
and in addition all inherited ACEs will be added without the (ID) flag
set.
Using this command correspondents to unchecking "Allow inheritable
permissions from parent to propagate to this object" in the Security
| Permissions dialog of RegEdt32 and answering the following
question with "Copy".
The command /PR
This command Protects a key and Removes formerly inherited
permissions. ACEs defined directly for this key will not change, but all
inherited ACEs with the (ID) flag set will be removed. Make sure there
are already some ACEs defined for the key directly before removing all
inherited permissions, otherwise you will end up with no access to the
key in RegEdt32! (There are emergency exits when you made such a
mistake: Either take ownership and give yourself full access to the key
or use RegDACL ;-)
Using this command correspondents to unchecking "Allow inheritable
permissions from parent to propagate to this object" in the Security
| Permissions dialog of RegEdt32 and answering the following
question with "Remove".
The command /PROPAGATE
This command (available only in the registered
version of RegDACL) PROPAGATES permissions.
It matches the checkbox "Reset permissions on all child objects and enable
propagation of inheritable permissions" in RegEdt32. The command
removes explicitly defined permissions on all subkeys and enables propagation
of inheritable permissions to those subkeys. Only inheritable permissions
propagated from the specified key will take effect after applying this
command. Be warned, even the DACLs of formerly protected
subkeys will be overwritten by this powerful command! Do not use this command
with keys installed by Windows 2000 itself, you might brake some functionality!
For demonstrating the next commands, let us start with the following permissions:
C:\Reg> RegDACL
hklm\software\test /l -subtree
Access Access Control List for Registry key
"hklm\software\test":
Access Control List for Registry key "hklm\software\test\Subkey1":
|
C:\Reg> RegDACL
hklm\software\test\subkey1 /gga:F /ggu:R
Access Granting F access for predefined group
"Administrators"
Granting R access for predefined group "Users"
C:\Reg> RegDACL hklm\software\test\subkey1 /l Access Control List for Registry key "hklm\software\test\Subkey1":
|
C:\Reg> RegDACL
hklm\software\test\subkey1 /sgu:cwq
Setting CWQ permissions for predefined group
"Users"
C:\Reg> RegDACL hklm\software\test\subkey1 /l Access Control List for Registry key "hklm\software\test\subkey1":
|
The command /R
This command removes all explicit ACEs for the specified group
from the DACL:
C:\Reg> RegDACL
hklm\software\test\subkey1 /rgu
Revoking access for predefined group "Users"
C:\Reg> RegDACL hklm\software\test\subkey1 /l Access Control List for Registry key "hklm\software\test\subkey1":
|
The command /D
This command causes roughly the contrary of the command /G. It adds
an ACESS-DENY entry on top of the DACL. If there are ACCESS-ALLOW entries
with the specified permissions for this group, they will be changed or
removed:
C:\Reg> RegDACL
hklm\software\test\subkey1 /dgu:EWS
Denying EWS access for predefined group "Users"
C:\Reg> RegDACL hklm\software\test\subkey1 /l Access Control List for Registry key "hklm\software\test\subkey1":
|
Attention!
There are really efficient examples for the use of the command /D,
and there is no known version of NT, which has problems with DACLs with
DENY ACEs. For
unknown reasons though, Regedt32 of NT 4 can't handle such DACLs. In
such a case, it deletes the complete DACL when you choose Security
| Permissions and answer the question that follows with "yes"!
The command /CLEAR
(only available in the registered version
of RegDACL)
With the /clear command you tell RegDACL to delete all
noninherited ACEs of the DACL, prior to setting new ACE(s). To prevent
the creation of empty DACLs (generating one for a Registry key is not a
good idea at all), this command is only allowed in conjunction with the
command /S. It is also possible to combine it with the switch -SUBTREE.
If you don't want to replace existing ACEs, but only
want to remove all explicitly defined permissions, you shold use the command
/P- instead of /CLEAR!
Alternatively it is possible to remove superfluous ACEs with the command
/R, but with this command you need to name all accounts you want
to remove one by another.
Is everything clear now?
When you have read this document carefully and you still have a question
or are vague regarding a topic, you can email to fh@heysoft.de.
But please check first the Security
FAQ for the Windows NT Registry - your question might be already answered
there. If you find errors or would like to contribute knowledge to this
document, you are encouraged to email us, too.
When your mother tongue is not English or German, you can translate
this documentation into your native language and get a registered version
of RegTools for free (but you need to ask first, before you start,
in case somebody else is working on the same project!)